/**
 * An alternate way of storing symbols so that they can be
 * compared by line number instead of lexicographically.
 * 
 * @author James Stanier
 */
public class SymbolLineNo extends Symbol implements Comparable {
	String type;
	int id;
	String label;
	int lineNumber;
	
	/**
	 * Constructor.
	 * @param s The lexeme representing the symbol.
	 * @param i The id number of the symbol.
	 * @param t The type of the symbol.
	 * @param l The line number that the symbol starts on.
	 */
	public SymbolLineNo(String s, int i, String t, int l) {
		super(s, i, t, l);
	}
	
	/**
	 * Comparison method for comparing symbols by line number.
	 */
	public int compareTo(Object s) throws ClassCastException {
		if(s instanceof Symbol) {
			Integer a = this.getLineNumber();
			Integer b = ((Symbol)s).getLineNumber();
			return a.compareTo(b);
		}
		else {
			throw new ClassCastException("Object is not of type Symbol.");
		}
	}
}
